package com.example.myapplication

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.NavHostFragment
import com.example.myapplication.databinding.FragmentFirstBinding
import com.xinnuo.analytics.android.ui.TrackFragment

class FirstFragment : TrackFragment() {

    private var binding: FragmentFirstBinding? = null

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentFirstBinding.inflate(inflater, container, false)
        // Inflate the layout for this fragment
        return binding!!.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        binding!!.button.setOnClickListener {
            val controller = NavHostFragment.findNavController(this)
            controller.navigate(R.id.action_firstFragment_to_secondActivity)
        }

        binding!!.button1.setOnClickListener {
            val controller = NavHostFragment.findNavController(this)
            controller.navigate(R.id.action_firstFragment_to_secondFragment)
        }
    }

    override fun onDestroyView() {
        super.onDestroyView()
        binding = null
    }

}